# contactinfoui.py

from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(800, 750)
        self.verticalLayout = QtWidgets.QVBoxLayout(Form)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName("verticalLayout")
        
        # 顶部工具栏
        self.top_toolbar = QtWidgets.QWidget(Form)
        self.top_toolbar.setObjectName("TopToolBar")
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.top_toolbar)
        
        self.btn_analysis = QtWidgets.QPushButton(self.top_toolbar)
        self.btn_analysis.setObjectName("TabButton")
        self.btn_analysis.setCheckable(True)
        self.btn_analysis.setChecked(True)
        self.horizontalLayout_3.addWidget(self.btn_analysis)
        
        self.btn_emotion = QtWidgets.QPushButton(self.top_toolbar)
        self.btn_emotion.setObjectName("TabButton")
        self.btn_emotion.setCheckable(True)
        self.horizontalLayout_3.addWidget(self.btn_emotion)
        
        self.btn_report = QtWidgets.QPushButton(self.top_toolbar)
        self.btn_report.setObjectName("TabButton")
        self.btn_report.setCheckable(True)
        self.horizontalLayout_3.addWidget(self.btn_report)
        
        self.horizontalLayout_3.addStretch() # 将右侧按钮推到最右边
        
        # --- 【关键修正】: 重新添加 btn_back 控件 ---
        # 把它放在导出按钮之前，作为一个独立的动作按钮
        self.btn_back = QtWidgets.QToolButton(self.top_toolbar)
        self.btn_back.setObjectName("BackButton") # 可以为其单独设置样式
        self.btn_back.setToolTip("返回")
        # 您需要在逻辑代码中为它设置图标，这里用一个Unicode箭头作为占位符
        self.btn_back.setText("←")
        font = self.btn_back.font()
        font.setPointSize(16)
        self.btn_back.setFont(font)
        self.btn_back.setMinimumSize(QtCore.QSize(40, 32))
        self.horizontalLayout_3.addWidget(self.btn_back)
        # --- 修正结束 ---

        self.toolButton_output = QtWidgets.QToolButton(self.top_toolbar)
        self.toolButton_output.setObjectName("ExportButton")
        self.toolButton_output.setPopupMode(QtWidgets.QToolButton.MenuButtonPopup)
        self.toolButton_output.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
        self.horizontalLayout_3.addWidget(self.toolButton_output)
        
        self.verticalLayout.addWidget(self.top_toolbar)
        
        # 内容区域
        self.stackedWidget = QtWidgets.QStackedWidget(Form)
        self.stackedWidget.setObjectName("stackedWidget")
        self.verticalLayout.addWidget(self.stackedWidget, 1)

        self.retranslateUi(Form)
        self.stackedWidget.setCurrentIndex(-1)
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        _translate = QtCore.QCoreApplication.translate
        Form.setWindowTitle(_translate("Form", "Contact Info"))
        self.btn_analysis.setText(_translate("Form", "统计信息"))
        self.btn_emotion.setText(_translate("Form", "情感分析"))
        self.btn_report.setText(_translate("Form", "年度报告"))
        self.toolButton_output.setText(_translate("Form", "导出聊天记录"))